<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://unpkg.com/vue@next"></script>
  <style>
  </style>
</head>
<body>
  <div id="app">
    <div>{{ count }}</div>
    <button @click="getCount">点击</button>
    <div>{{ count2 }}</div>
    <button @click="getCount2">点击</button>
  </div>

  <script>
    const myMixin = {
      data() {
        return {
          count: 0
        }
      },
      methods: {
        getCount() {
          this.count += 1
        }
      }
    }
    const app = Vue.createApp({
      mixins: [myMixin],
      setup() {
        let count2 = Vue.ref(0)
        const getCount2 = () => count2.value = count2.value + 1
        return { count2, getCount2 }
      }
    })

    app.mount('#app')
  </script>
</body>
</html>